package book_management.user;

import book_management.operation.IOperation;
import book_management.operation.impl.*;

// 管理员

/**
 * 1.添加书籍
 * 2.删除书籍
 * 3.更新书籍
 * 4.查找书籍
 * 5.显示当前书籍列表
 * -1.退出
 */
public class AdminUser extends User{
    public AdminUser(String userName) {
        this.name = userName;
        operations = new IOperation[] {
                new AddOperation(),
                new RemoveOperation(),
                new UpdateOperation(),
                new FindOperation(),
                new DisplayOperation()
        };
    }

    /**
     *  * 1.添加书籍
     *  * 2.删除书籍
     *  * 3.更新书籍
     *  * 4.查找书籍
     *  * 5.显示当前书籍列表
     *  * -1.退出
     * @return
     */
    @Override
    public int menu() {
        System.out.println("======================================");
        System.out.println("欢迎"+this.name+"登录财大图书馆管理系统");
        System.out.println("1.添加书籍");
        System.out.println("2.删除书籍");
        System.out.println("3.更新书籍");
        System.out.println("4.查找书籍");
        System.out.println("5.显示当前书籍列表");
        System.out.println("-1.退出");
        System.out.println("请输入您的选择:");
        int choice = scanner.nextInt();
        // 切记不要在这关闭scanner，当用户输入-1退出时再关闭scanner
        return choice;
    }
}
